//package org.szy.core.auth.config;
//
//import lombok.Getter;
//import org.noear.solon.annotation.Configuration;
//import org.noear.solon.annotation.Init;
//import org.noear.solon.annotation.Inject;
//
///**
// * 文件服务配置类
// *
// * @author wangbuhao
// * @date 2022-08-19
// * @since 1.0.0
// **/
//@Configuration
//@Getter
//public class FileProperties {
//
//    @Init
//    public void init(@Inject("${jinyu.file}") FileProperties config) {
//        System.out.printf("初始化文件配置");
//        System.out.println(config.toString());
//    }
//
//    /**
//     * 默认文件最大 50M
//     */
//    @Inject(value = "${jinyu.file.fileMaxSize}", autoRefreshed = true)
//    public long fileMaxSize = 50 * 1024 * 1024;
//
//    /**
//     * 默认的文件名最大长度 100
//     */
//    @Inject(value = "${jinyu.file.fileNameLength}", autoRefreshed = true)
//    public int fileNameLength = 100;
//
//    /**
//     * 上传文件存储在本地的根路径
//     */
//    @Inject(value = "${jinyu.file.localFilePath}", autoRefreshed = true)
//    public String localFilePath = "D:/wbh";
//
//    /**
//     * 资源映射路径 前缀
//     */
//    @Inject(value = "${jinyu.file.localFilePrefix}", autoRefreshed = true)
//    public String localFilePrefix = "upload";
//
//    /**
//     * 文件存放的域名
//     */
//    @Inject(value = "${jinyu.file.domain}", autoRefreshed = true)
//    public String domain;
//
//    /**
//     * 是否启用域名，文件上传后拼接域名
//     */
//    @Inject(value = "${jinyu.file.enableDomain}", autoRefreshed = true)
//    public boolean enableDomain = false;
//
//    /**
//     * 不允许上传的后缀名
//     */
//    @Inject(value = "${jinyu.file.notAllowedExtension}", autoRefreshed = true)
//    public String notAllowedExtension;
//
//
//}

package org.szy.core.common.prop;


import org.noear.solon.Solon;
import org.noear.solon.SolonProps;

import java.io.File;

/**
 * 文件服务配置类
 *
 * @author wangbuhao
 * @date 2022-08-19
 * @since 1.0.0
 **/
//@Configuration
//@Inject(value = "${jinyu.file}", autoRefreshed = true)
public class FileProperties {

    private static SolonProps props = Solon.cfg();
    /**
     * 默认文件最大 50M
     */
    public static long fileMaxSize = props.getLong("jinyu.file.fileMaxSize", 50 * 1024 * 1024);
    /**
     * 默认的文件名最大长度 100
     */
    public static int fileNameLength = props.getInt("jinyu.file.fileNameLength", 100);
    /**
     * 上传文件存储在本地的根路径
     */
    public static String localFilePath = props.get("jinyu.file.localFilePath", "D:" + File.separator + "wbh");
    /** 删除文件后存放的地址 */
    public static String localRemovePath = props.get("jinyu.file.localRemovePath", "D:" + File.separator + "wbh" + File.separator + "remove");
    /**
     * 资源映射路径 前缀
     */
    public static String localFilePrefix = props.get("jinyu.file.localFilePrefix", "upload");
    /**
     * 文件存放的域名
     */
    public static String domain = props.get("jinyu.file.domain");
    /**
     * 是否启用域名，文件上传后拼接域名
     */
    public static boolean enableDomain = props.getBool("jinyu.file.enableDomain", false);
    /**
     * 不允许上传的后缀名
     */
    public static String notAllowedExtension = props.get("jinyu.file.notAllowedExtension");

    public static SolonProps getProps() {
        return props;
    }

    public static void setProps(SolonProps props) {
        FileProperties.props = props;
    }

    public static long getFileMaxSize() {
        return fileMaxSize;
    }

    public static void setFileMaxSize(long fileMaxSize) {
        FileProperties.fileMaxSize = fileMaxSize;
    }

    public static int getFileNameLength() {
        return fileNameLength;
    }

    public static void setFileNameLength(int fileNameLength) {
        FileProperties.fileNameLength = fileNameLength;
    }

    public static String getLocalFilePath() {
        return localFilePath;
    }

    public static void setLocalFilePath(String localFilePath) {
        FileProperties.localFilePath = localFilePath;
    }

    public static String getLocalRemovePath() {
        return localRemovePath;
    }

    public static void setLocalRemovePath(String localRemovePath) {
        FileProperties.localRemovePath = localRemovePath;
    }

    public static String getLocalFilePrefix() {
        return localFilePrefix;
    }

    public static void setLocalFilePrefix(String localFilePrefix) {
        FileProperties.localFilePrefix = localFilePrefix;
    }

    public static String getDomain() {
        return domain;
    }

    public static void setDomain(String domain) {
        FileProperties.domain = domain;
    }

    public static boolean isEnableDomain() {
        return enableDomain;
    }

    public static void setEnableDomain(boolean enableDomain) {
        FileProperties.enableDomain = enableDomain;
    }

    public static String getNotAllowedExtension() {
        return notAllowedExtension;
    }

    public static void setNotAllowedExtension(String notAllowedExtension) {
        FileProperties.notAllowedExtension = notAllowedExtension;
    }
}
